|
|
|
|
|
|
|
BitBlt lngNewPicDC, 0, 0, bmpSource.bmWidth, bmpSource.bmHeight, _
lngMaskDC, 0, 0, vbSrcAnd
'*****************************************************************
' AND the inverse mask with the source bitmap to turn off the bits
' associated with transparent area of source bitmap by making it
' black
'*****************************************************************
BitBlt lngSrcDC, 0, 0, bmpSource.bmWidth, bmpSource.bmHeight, _
lngInvDC, 0, 0, vbSrcAnd
'*****************************************************************
' XOR the result with the source bitmap to replace the mask color
' with the background color
'*****************************************************************
BitBlt lngNewPicDC, 0, 0, bmpSource.bmWidth, bmpSource.bmHeight, _
lngSrcDC, 0, 0, vbSrcPaint
'*****************************************************************
' Paint the transparent bitmap on source surface
'*****************************************************************
BitBlt objDest.hdc, lngX, lngY, bmpSource.bmWidth, _
bmpSource.bmHeight, lngNewPicDC, 0, 0, vbSrcCopy
'*****************************************************************
' Restore backup of bitmap
'*****************************************************************
BitBlt lngSrcDC, 0, 0, bmpSource.bmWidth, bmpSource.bmHeight, _
lngSaveDC, 0, 0, vbSrcCopy
'*****************************************************************
' Restore the original objects by selecting their original values
'*****************************************************************
SelectObject lngSrcDC, hSrcPrevBmp
SelectObject lngSaveDC, hSavePrevBmp
SelectObject lngNewPicDC, hDestPrevBmp
SelectObject lngMaskDC, hMaskPrevBmp
SelectObject lngInvDC, hInvPrevBmp
'*****************************************************************
' Free system resources created by this sub
'*****************************************************************
DeleteObject hSaveBmp
DeleteObject hMaskBmp
DeleteObject hInvBmp
DeleteObject hResultBmp
DeleteDC lngSrcDC
DeleteDC lngSaveDC
DeleteDC lngInvDC
DeleteDC lngMaskDC
DeleteDC lngNewPicDC
'*****************************************************************
' Restores the ScaleMode to its original value
'*****************************************************************
objDest.ScaleMode = lngOrigScaleMode
End Sub |
|
|
|
|
|